<template>
  <div class="dv-loading" v-show="visible">
    <img class="dv-loading-img" src="~@/assets/svg/loading.svg" alt="">
    <div class="loading-tip">
      <slot>
        <span>{{ text }}</span>
      </slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DvLoading',
  data() {
    return {
      text: null,
      spinner: null,
      background: null,
      fullscreen: true,
      visible: false,
      customClass: '',
    };
  },
  methods: {
    handleAfterLeave() {
      this.$emit('after-leave');
    },
    setText(text) {
      this.text = text;
    },
  },
};
</script>

<style lang="less" scoped>
.dv-loading {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(5, 21, 53, 0.95);

  .dv-loading-img {
    width: 50px;
    height: 50px;
  }

  .loading-tip {
    font-size: 15px;
  }
}
</style>
<style>
.loading-parent--relative {
  position: relative !important;
}

.loading-parent--hidden {
  overflow: hidden !important;
}
</style>
